﻿using System;
using System.Collections.Generic;
using System.Text;
using NExt;
using NExt.Core.Model.Base;
using NExt.UI.Resource.Icon;

namespace NExt.UI.Browse.Base
{
    public class BrowsePresenterBase: AbstractBrowsePresenter
    {
        public Toolbarr toolbar;
        public NExt.Toolbar.Button tbbRefresh;

        protected IScript onTbbRefreshInvoked;

        protected override void FormBuildComponents()
        {
            base.FormBuildComponents();
            toolbar = new Toolbarr();
            tbbRefresh = new NExt.Toolbar.Button();
        }

        protected override void FormInitializeEvents()
        {
            base.FormInitializeEvents();
            onTbbRefreshInvoked = fireRefresh;
        }

        protected override void FormInitializeComponents()
        {
            base.FormInitializeComponents();

            tbbRefresh.text = "Refresh";
            tbbRefresh.iconCls = IconCls.Refresh16;
            tbbRefresh.listeners.click = onTbbRefreshInvoked;
            toolbar.buttons.Add(tbbRefresh);

            items.Add(toolbar);
        }
    }
}
